#include "ALLMenu.h"
#include "Show.h"

PauseMenu::PauseMenu(PlayMenu01 *FM, IMenu *GM) {
	FatherMenu = FM;
	UpperMenu = GM;
	Name.push_back("Back to Upper Menu");
	Name.push_back("Continue");
	Name.push_back("Save");
	NextMenu = new IMenu*[item];
	NextMenu[0] = UpperMenu;
	NextMenu[1] = FatherMenu;
	NextMenu[2] = new SaveMenu(this, FatherMenu);
}

PauseMenu::~PauseMenu() {
	delete NextMenu[2];
	delete[] NextMenu;
}

std::string PauseMenu::GetMyName() {
	return Myname;
}

bool PauseMenu::process() {
	int opt = -1;
	while(opt == -1) {
		Show show(this);
		show.Display();
		Choose chs;
		opt = chs.Option(this);
	}
	//std::cout << (NextMenu[opt] == nullptr );
	if(NextMenu[opt] == UpperMenu) {
		FatherMenu->Reset();
	}
	MenuMgr::getInstance().SetActiveMenu(NextMenu[opt]);
	return !OVER;
}

std::string PauseMenu::GetChildName(int k) {
	return Name[k];
}

int PauseMenu::GetItem() {
	return item;
}
